package com.panda.web.controller.wechatinfo;

import com.panda.common.annotation.Log;
import com.panda.common.core.controller.BaseController;
import com.panda.common.core.domain.AjaxResult;
import com.panda.common.core.domain.R;
import com.panda.common.enums.BusinessType;
import com.panda.web.domain.dto.wechatinfo.ProgressJobDTO;
import com.panda.web.domain.vo.wechatinfo.ProgressJobVO;
import com.panda.web.service.wechatinfo.IProgressJobService;
import com.panda.web.service.wechatinfo.IProgressJobService;
import com.panda.web.utils.pageutils.PageResult;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;
import java.util.List;


/**
 * 岗位收藏Controller
 *
 * @author cpanda
 * @date 2025-07-19
 */
@CrossOrigin
@RestController
@RequestMapping("/web/progress")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class ProgressJobController extends BaseController {
    private final IProgressJobService jobService;

    /**
     * 查询岗位收藏列表
     */
    @GetMapping("/list")
    public PageResult<ProgressJobVO> List(ProgressJobDTO dto,
                                          @RequestParam("pageNum") Integer pageNum,
                                          @RequestParam("pageSize") Integer pageSize) {
        //返回分页信息
        PageResult<ProgressJobVO> voList = jobService.PageList(dto,pageNum,pageSize);
        return voList;
    }


    /**
     * 查询岗位收藏列表 无分页
     */
    @GetMapping("/choiceList")
    public R choiceList(ProgressJobDTO dto) {
        List<ProgressJobVO> voList = jobService.choiceList(dto);
        return R.ok(voList,"ok");
    }


    /**
     * 岗位进度添加
     */
    @Log(title = "岗位收藏", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProgressJobDTO dto) throws ParseException {
        return toAjax(jobService.insert(dto));
    }



}
